﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Sto5a01
    {
        private DateTime? _checkdate;
		private string _pid;
        private int? _productno;
		private string _productname;
		private string _barcode;
		private string _checkadd;
		private double _sqty;
		private double _pqty;
		private double _bqty;
		private double _pamt;
		private double _bamt;
		private string _chkno;
		private string _chkid;
		
        /// <summary>
        /// 盘点日期
        /// </summary>
		public DateTime? Checkdate
		{
			get { return _checkdate;	 }
			set { _checkdate=value;	}
		}
        /// <summary>
        /// 商品标识
        /// </summary>
		public string Pid
		{
			get { return _pid;	 }
			set { _pid=value;	}
		}
        /// <summary>
        /// 货号
        /// </summary>
		public int? Productno
		{
			get { return _productno;	 }
			set { _productno=value;	}
		}
        /// <summary>
        /// 名称
        /// </summary>
		public string Productname
		{
			get { return _productname;	 }
			set { _productname=value;	}
		}
        /// <summary>
        /// 条码
        /// </summary>
		public string Barcode
		{
			get { return _barcode;	 }
			set { _barcode=value;	}
		}
        /// <summary>
        /// 盘点地址
        /// </summary>
		public string Checkadd
		{
			get { return _checkadd;	 }
			set { _checkadd=value;	}
		}
        /// <summary>
        /// 标准库存
        /// </summary>
		public double Sqty
		{
			get { return _sqty;	 }
			set { _sqty=value;	}
		}
        /// <summary>
        /// 盘点库存
        /// </summary>
		public double Pqty
		{
			get { return _pqty;	 }
			set { _pqty=value;	}
		}
        /// <summary>
        /// 差异
        /// </summary>
		public double Bqty
		{
			get { return _bqty;	 }
			set { _bqty=value;	}
		}
        /// <summary>
        /// 成本
        /// </summary>
		public double Pamt
		{
			get { return _pamt;	 }
			set { _pamt=value;	}
		}
        /// <summary>
        /// 金额差异
        /// </summary>
		public double Bamt
		{
			get { return _bamt;	 }
			set { _bamt=value;	}
		}
        /// <summary>
        /// 盘点号
        /// </summary>
		public string Chkno
		{
			get { return _chkno;	 }
			set { _chkno=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Chkid
		{
			get { return _chkid;	 }
			set { _chkid=value;	}
		}
		
		public static List<Sto5a01> GetSto5a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Sto5a01> list = new List<Sto5a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Sto5a01 model = GetSto5a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Sto5a01 GetSto5a01ByDataRow(DataRow dr)
		{
			Sto5a01 model = new Sto5a01(); //实例化Sto5a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("checkdate")&&!(dr["checkdate"] is System.DBNull))  
				model.Checkdate = ( DateTime)dr["checkdate"];
			if (dcc.Contains("pid")&&!(dr["pid"] is System.DBNull))  
				model.Pid = ( string)dr["pid"];
			if (dcc.Contains("productno")&&!(dr["productno"] is System.DBNull))  
				model.Productno = ( int)dr["productno"];
			if (dcc.Contains("productname")&&!(dr["productname"] is System.DBNull))  
				model.Productname = ( string)dr["productname"];
			if (dcc.Contains("barcode")&&!(dr["barcode"] is System.DBNull))  
				model.Barcode = ( string)dr["barcode"];
			if (dcc.Contains("checkadd")&&!(dr["checkadd"] is System.DBNull))  
				model.Checkadd = ( string)dr["checkadd"];
			if (dcc.Contains("sqty")&&!(dr["sqty"] is System.DBNull))  
				model.Sqty = Convert.ToDouble(dr["sqty"]);
			if (dcc.Contains("pqty")&&!(dr["pqty"] is System.DBNull))  
				model.Pqty = Convert.ToDouble(dr["pqty"]);
			if (dcc.Contains("bqty")&&!(dr["bqty"] is System.DBNull))  
				model.Bqty = Convert.ToDouble(dr["bqty"]);
			if (dcc.Contains("pamt")&&!(dr["pamt"] is System.DBNull))  
				model.Pamt = Convert.ToDouble(dr["pamt"]);
			if (dcc.Contains("bamt")&&!(dr["bamt"] is System.DBNull))  
				model.Bamt = Convert.ToDouble(dr["bamt"]);
			if (dcc.Contains("chkno")&&!(dr["chkno"] is System.DBNull))  
				model.Chkno = ( string)dr["chkno"];
			if (dcc.Contains("chkid")&&!(dr["chkid"] is System.DBNull))  
				model.Chkid = ( string)dr["chkid"];
			
			return model;
		}
    }
}
